import http from "../request.js";
const header = { "Content-Type": "application/x-www-form-urlencoded" };

class OrderCenter {
  constructor() {
		this.orderBuyNowApi =              "/api/hqshop/order/buyNow";                    // 单个商品立即购买
		this.buyNow_payApi =               "/api/hqshop/order/buyNow_pay";                // 单个商品确认下单
		this.orderDetailApi =              "/api/hqshop/order/detail";                    // 订单详情
		this.yuepay_Api =                  "/api/hqshop/order/yuepay";                    // 余额支付
		this.orderMyApi =                  "/api/hqshop/order/my";                        // 订单列表
		this.orderFinishApi =              "/api/hqshop/order/finish";                    // 确定收货
    this.demand_CourierApi =           "/api/hqshop/order/demand_Courier";            // 物流详情
		
		this.cancel_orderApi =             "/api/hqshop/orderrefund/cancel_order";        // 订单取消
		this.after_sale_goods1Api =        "/api/hqshop/orderrefund/after_sale_goods1";   // 待发货单个商品退款
		this.after_sale_orders1Api =       "/api/hqshop/orderrefund/after_sale_orders1";  // 待发货订单发起退款
		this.after_sale_goodsApi =         "/api/hqshop/orderrefund/after_sale_goods";    // 待收货单个商品退款
		this.after_sale_ordersApi =        "/api/hqshop/orderrefund/after_sale_orders";   // 待收货订单申请退款
		this.after_sale1Api =              "/api/hqshop/orderrefund/after_sale1";         // 待收货，换货
		this.after_saleSticsApi =          "/api/hqshop/orderrefund/after_sale2";         // 买家回填售后快递
		
		this.rufund_infoApi =              "/api/hqshop/orderrefund/rufund_info";         // 退款原因
		this.get_history_Api =             "/api/hqshop/orderrefund/get_history";         // 售后订单列表
		this.get_refunddetail_Api =        "/api/hqshop/orderrefund/get_refunddetail";    // 售后订单详情
		this.del_order_Api =               "/api/hqshop/orderrefund/del_order";           // 删除维权订单
		this.cancel_saleApi =              "/api/hqshop/orderrefund/cancel_sale";         // 取消售后
    
		
		this.comments_add_Api =            "/api/hqshop/comments/comments_add";           // 商品评价
  } 
	orderBuyNow(data) {
	  return http.post(this.orderBuyNowApi,data,{header}).then((res) => res.data);
	}
	buyNow_pay(data) {
	  return http.post(this.buyNow_payApi,data,{header}).then((res) => res.data);
	}
	orderDetail(params) { // 订单详情
	  return http.post(this.orderDetailApi, params || {}).then((res) => res.data);
	}
	yuepay(params) { // 支付
	  return http.post(this.yuepay_Api, params || {}).then((res) => res.data);
	}
	orderMy(params) { // 订单列表
	  return http.post(this.orderMyApi, params || {}).then((res) => res.data);
	}
	orderFinish(params) { // 确定收货
	  return http.post(this.orderFinishApi, params || {}).then((res) => res.data);
	}
  demand_Courier(params) { // 物流详情
    return http.post(this.demand_CourierApi, params || {}).then((res) => res.data);
  }
	
	cancel_order(params) { // 订单取消
	  return http.post(this.cancel_orderApi, params || {}, {header}).then((res) => res.data);
	}
	after_sale_goods1(params) { // 待发货单个商品退款
	  return http.post(this.after_sale_goods1Api, params || {}, {header}).then((res) => res.data);
	}
	after_sale_orders1(params) { // 待发货整个订单发起退款
	  return http.post(this.after_sale_orders1Api, params || {}, {header}).then((res) => res.data);
	}
	after_sale_goods(params) { // 待收货单个商品退款
	  return http.post(this.after_sale_goodsApi, params || {}, {header}).then((res) => res.data);
	}
	after_sale_orders(params) { // 待收货订单申请退款
	  return http.post(this.after_sale_ordersApi, params || {}, {header}).then((res) => res.data);
	}
	after_sale1(params) { // 待收货，换货
	  return http.post(this.after_sale1Api, params || {}, {header}).then((res) => res.data);
	}
	after_saleStics(params) { // 买家回填售后快递
	  return http.post(this.after_saleSticsApi, params || {}, {header}).then((res) => res.data);
	}
	
	
	rufund_info(params) { // 退款原因
	  return http.post(this.rufund_infoApi, params || {}, {header}).then((res) => res.data);
	}
	get_history(params) { // 售后订单列表
	  return http.post(this.get_history_Api, params || {}, {header}).then((res) => res.data);
	}
	get_refunddetail(params) { // 售后订单列表
	  return http.post(this.get_refunddetail_Api, params || {}, {header}).then((res) => res.data);
	}
	del_order(params) { // 删除维权订单
	  return http.post(this.del_order_Api, params || {}, {header}).then((res) => res.data);
	}
	cancel_sale(params) { // 取消售后
	  return http.post(this.cancel_saleApi, params || {}, {header}).then((res) => res.data);
	}
	
	comments_add(params) { // 商品评价
	  return http.post(this.comments_add_Api, params || {}, {header}).then((res) => res.data);
	}
	
}

export const OrderCenterApi = new OrderCenter();
